package com.quectel.sdk.kuangshi.monitor;

import com.fasterxml.jackson.core.type.TypeReference;
import com.quectel.sdk.kuangshi.AbstractKsBaseClient;
import com.quectel.sdk.kuangshi.basemodel.KsBaseResp;
import com.quectel.sdk.kuangshi.monitor.model.SyncDeviceResp;
import com.quectel.sdk.kuangshi.monitor.model.SyncVideoResp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 在这里编写说明
 *
 * @author: rananxin
 * @email: ryan.ran@quectel.com
 * @date: 2022-10-19 11:01:00
 */
public class MonitorClient extends AbstractKsBaseClient {

    public static final String PUBLIC_PATH = "v1/MEGBOX/";
    private static final Integer SUCCESS_CODE = 0;
    private static final Logger LOGGER = LoggerFactory.getLogger(MonitorClient.class);

    /**
     * 获取盒子设备信息
     *
     * @return
     */
    public SyncDeviceResp drawDevices() {
        KsBaseResp<SyncDeviceResp> resp = requester.get(PUBLIC_PATH + "devices", null, new TypeReference<KsBaseResp<SyncDeviceResp>>() {
        });
        if (SUCCESS_CODE.equals(resp.getCode())) {
            return resp.getData();
        }
        return null;
    }

    /**
     * 获取流信息
     *
     * @return
     */
    public SyncVideoResp drawVideos() {
        KsBaseResp<SyncVideoResp> resp = requester.get(PUBLIC_PATH + "multiAlgVideos", null, new TypeReference<KsBaseResp<SyncVideoResp>>() {
        });
        if (SUCCESS_CODE.equals(resp.getCode())) {
            return resp.getData();
        }
        return null;
    }

}
